<?php

namespace App\Http\Requests\Api\Admin;

use App\Http\Requests\Api\FormRequest;

class AdminUserUpdateRequest extends FormRequest
{
    public function rules()
    {
        return [
            'name' => ['required', 'max:16', 'min:2'],
            'wechat' => ['nullable', 'max:32', 'min:6'],
            'qq' => ['nullable', 'numeric'],
            'email' => ['nullable', 'email:rfc,dns']
        ];
    }

    public function messages()
    {
        return [
            'name.unique' => '用户名已经存在',
            'name.required' => '用户名不能为空',
            'name.max' => '用户名最大长度为16个字符',
            'name.min' => '用户名最小长度为2个字符',
            'wechat.max' => '微信号格式不正确',
            'wechat.min' => '微信号格式不正确',
            'email.email' => '邮箱格式不正确'
        ];
    }

}
